// pages/data/data.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },
  add: function() {
    wx.setStorage({
      key: "mykey",
      data: "myvalue",
      success: function() {
        console.log("success")
      }
    })
  },
  get: function() {
    wx.getStorage({
      key: "mykey",
      success: function(res) {
        console.log(res.data)
      }
    })
  },
  findall: function() {
    wx.getStorageInfo({
      success: function(res) {
        console.log(res.keys)
        console.log(res.currentSize)
        console.log(res.limitSize)
      }
    })

  },
  clear: function() {
    wx.removeStorage({
      key: 'mykey',
      success: function(res) {
        console.log(res.data)
      }
    })
  },
  clearall: function() {
    wx.clearStorage()
  },
  getlocation: function() {
    wx.getLocation({
      type: 'wgs84',
      latitude: true,
      success: function(res) {
        console.log(res)
      },
    })

  },
  chooselocation: function() {
    wx.chooseLocation({
      success: function(res) {
        console.log(res)
      },
    })
  },
  findlocation: function() {
    wx.openLocation({
      latitude: 28.13551,
      longitude: 113.03555,
      scale: 5,
      name: "长沙民政学院",
      address: "长沙市雨花区香樟路"
    })

  },
  getinfo: function() {
    wx.getSystemInfo({
      success: function(res) {
        console.log(res)
      }
    })
  },
  getnetwork: function() {
    wx.getNetworkType({
      success: function(res) {
        console.log(res)
      },
    })
    wx.onNetworkStatusChange(function(res) {
      console.log(res.isConnected)
      console.log(res.networkType)
    })
  },
  makecall: function() {
    wx.makePhoneCall({
      phoneNumber: "18711377107",
      success: function() {

      }

    })
  },
  scan: function() {
    wx.scanCode({
      success: function(res) {
        console.log(res)
      }
    })
  },
  setscreen: function() {
    wx.setScreenBrightness({
      value:0.5,
    })
    wx.vibrateLong({
      success:function(){
        
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})